from openai import OpenAI
import os

API_BASE = "https://ai-maas.wair.ac.cn/maas/v1"
API_KEY = os.getenv("TAICHU_API_KEY")

client = OpenAI(
    api_key=API_KEY,
    base_url=API_BASE
)
completion = client.chat.completions.create(
    model="taichu_llm",
    messages=[{"role": "user", "content": "你好"}],
    stream=True
)
for chunk in completion:
    print(chunk.choices[0].delta.content, end='')
